package com.studentapp.fragment;


import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.fragment.app.Fragment;

import com.studentapp.R;
import com.studentapp.bean.LoginGsonBean;
import com.studentapp.tool.StudentSpTool;

/**
 * A simple {@link Fragment} subclass.
 */
public class StudentFragment extends Fragment implements View.OnClickListener{


    private TextView name;
    private RelativeLayout name_click;
    private TextView department;
    private RelativeLayout department_click;
    private TextView major;
    private RelativeLayout major_click;
    private TextView telephone;
    private RelativeLayout telephone_click;

    public StudentFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_student, container, false);

        //初始化控件
        name = view.findViewById(R.id.name);
        name_click = view.findViewById(R.id.name_click);
        department = view.findViewById(R.id.department);
        department_click = view.findViewById(R.id.department_click);
        major = view.findViewById(R.id.major);
        major_click = view.findViewById(R.id.major_click);
        telephone = view.findViewById(R.id.telephone);
        telephone_click = view.findViewById(R.id.telephone_click);

        //获取到当前登录的用户信息
        LoginGsonBean.DataBean studentBean = new StudentSpTool(getContext()).getStudentBean();
        name.setText(studentBean.getName());
        department.setText(studentBean.getDepartment());
        major.setText(studentBean.getMajor());
        telephone.setText(studentBean.getTelephone()+"");

        return view;
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.name_click:

                break;
            case R.id.department_click:

                break;
            case R.id.major_click:

                break;
            case R.id.telephone_click:

                break;
        }
    }
}
